@extends('layouts.admin')
@section('content')
        <!--面包屑导航 开始-->
<div class="crumb_warp">
    <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
    <i class="fa fa-home"></i> <a href="{{url('admin/info')}}">首页</a> &raquo; 自定义导航管理
</div>
<!--面包屑导航 结束-->

<!--搜索结果页面 列表 开始-->
<form action="#" method="post">
    <div class="result_wrap">
        <div class="result_title">
            <h3>自定义导航管理</h3>
        </div>
        <!--快捷导航 开始-->
        <div class="result_content">
            <div class="short_wrap">
                <a href="{{url('admin/navs/create')}}"><i class="fa fa-plus"></i>添加导航</a>
                <a href="{{url('admin/navs')}}"><i class="fa fa-recycle"></i>全部导航</a>
            </div>
        </div>
        <!--快捷导航 结束-->
    </div>

    <div class="result_wrap">
        <div class="result_content">
            <table class="list_tab">
                <tr>
                    <th class="tc" width="3%">排序</th>
                    <th class ="tc" width="3%">ID</th>
                    <th width="14%">导航名称</th>
                    <th>别名</th>
                    <th width="25%">导航地址</th>
                    <th width="18%">操作</th>
                </tr>
                @foreach($data as $v)
                 <tr>
                    <td class="tc">
                        <input type="text" onchange="changeOrder(this,{{$v->navs_id}})" name="ord[]" value="{{$v->navs_order}}">
                    </td>

                    <td class="tc">{{$v->navs_id}}</td>
                    <td class="tc">
                        <a href="#">{{$v->navs_name}}</a>
                    </td>
                    <td class="tc">{{$v->navs_title}}</td>
                    <td class="tc">{{$v->navs_url}}</td>
                    <td>
                        <a href="{{url('admin/navs/'.$v->navs_id.'/edit')}}">修改</a>
                        <a href="javascript:;" onclick="delnavs({{$v->navs_id}})">删除</a>
                    </td>
                </tr>
                @endforeach
            </table>

        </div>
    </div>
    <div>

    </div>
</form>
<!--搜索结果页面 列表 结束-->

<style>
    .result_content ul li span {
        font-size: 15px;
        padding: 6px 12px;
    }
</style>

<script>
    function changeOrder(obj,navs_id){
        var navs_order = $(obj).val();
        $.post("{{url('admin/navs/changeorder')}}",{'_token':'{{csrf_token()}}','navs_id':navs_id,'navs_order':navs_order},function(data){
            if(data.status == 0){
                layer.msg(data.msg, {icon: 6});
            }else{
                layer.msg(data.msg, {icon: 5});
            }
        });
    }

    //删除分类
    function delnavs(navs_id) {
        layer.confirm('您确定要删除这篇文章吗？', {
            btn: ['确定','取消'] //按钮
        }, function(){
            $.post("{{url('admin/navs/')}}/"+navs_id,{'_method':'delete','_token':"{{csrf_token()}}"},function (data) {
                if(data.status==0){
                    location.href = location.href;
                    layer.msg(data.msg, {icon: 6});
                }else{
                    layer.msg(data.msg, {icon: 5});
                }
            });
//            layer.msg('的确很重要', {icon: 1});
        }, function(){

        });
    }
</script>

@endsection
